<div class="main-ad">
  <div class="ad-header">
      <div class="line-one"><%=@advertisment.title -%></div>
      <div class="line-two"><%= @advertisment.location -%></div>
  </div>
  <div class="ad-tabs">
    <ul>
        <li class="selected"><a href="">About</a></li>
        <li>
            <%= link_to_remote "Comments",:url => {:controller=>"advertisments",:action => "comments",:id => @advertisment},:update => "details" -%>
        </li>
        <%unless @imagescount ==0 -%>
        <li>
            <%= link_to_remote  "Photos" ,:url => {:controller=>"advertisments",:action => "full_image",:id => @advertisment,:imageid=>@firstimage.id},:update => "details" -%>
        </li>
        <%end -%>
    </ul>
  </div>

  <div class="ad-inner">
      <div class="details" id="details">

        <div id="ad-image">
          <div  class="ad-image">
            <%if (@imagescount==0) -%>
              <%=link_to image_tag("noimage.jpg",:width=>"170px",:height=>"115px",:align=>"left", :border=>"0px") , "#" -%>
            <%else %>
              <%=image_tag "../attachments/"+@firstimage.id.to_s+"/"+@firstimage.filename,:width=>"170px",:height=>"115px",:align=>"left", :border=>"0px" -%>
            <%end -%>
          </div>
          <%if (@imagescount!=0) -%>
          <div class="enlarge-button">
            <%= link_to_remote  image_tag("enlarge-icon.jpg", :border=>"0px", :height=> "15px") ,:url => {:controller=>"advertisments",:action => "full_image",:id => @advertisment , :imageid => @firstimage}, :update => "details" -%>
          </div>
          <%end -%>
        </div>

        <div class="image-icons">
          <ul>
            <% @images.each do |image|-%>
            <li>
              <%= link_to_remote image_tag("../attachments/"+image.id.to_s+"/"+image.filename, :border=>"0px", :width=> "38px", :height=>"26px"), :url => {:controller=>"advertisments",:action => "swap_image",:id => @advertisment,:imageid => image}, :update => "ad-image" -%>
            </li>
            <%end -%>
          </ul>
        </div>

        <div class="comments-button">
          <%= link_to_remote image_tag("comments-icon.jpg", :border=>"0px"),:url => {:controller=>"advertisments",:action => "comments",:id => @advertisment},:update => "details" -%>
        </div>

        <div class="separator1"><%=image_tag "line.jpg", :border=>"0px" -%></div>

        <div class="ad-middle">
          <div class="ad-fields">
            <%unless @field_values.nil?%>
              <%@field_values.each do |field_value| -%>
              <div class="fields">
                <span style="font-weight:bold"><%=field_value[0].gsub("_"," ").capitalize -%></span> :
              </div>
              <div class="fields-value">
                  <span style="font-weight:normal"><%=field_value[1] -%></span>
              </div>
              <%end -%>
             <%end -%>
          </div>

          <div class="separator2"><%=image_tag "line.jpg"  -%></div>
           <div class="posted">
              <div class="posted-fields">Posted on:</div>
              <div class="posted-value"><%= @advertisment.created_at.to_formatted_s(:long_ordinal) %></div>

              <div class="posted-fields">Posted by:</div>
              <div class="posted-value"><%=@user.full_name -%><br />Student<br /><%= @university.name %></div>
           </div>

           <div class="view-profile">
              <%=link_to image_tag("view-profile.jpg", :width=>"72px",:height=>"19px",:border=>"0px"), "#" -%>
           </div>
         </div>
         <div class="description">
           <div class="description-heading">Description</div>
           <%= @advertisment.description %>
         </div>
      </div>

      <div class="right-column">
        <div class="ad-action-buttons">
          
          <div class="save-ad"><%=link_to image_tag("save-ad.jpg", :border=>"0px", :id=>params[:id]) + "&nbsp;&nbsp;Save Ad", "javascript:openSave("+params[:id]+");" -%></div>

          <div class="print"><%=link_to image_tag("print.jpg", :border=>"0px") + "&nbsp;&nbsp;Print", "javascript:print()" -%></div>
          <div class="email-to-friend">
            <%=link_to image_tag("email-to-friend.jpg", :border=>"0px") + "&nbsp;&nbsp;E-mail to friend","javascript:openEmailFriend("+params[:id]+");" -%>
          </div>
          <div class="report-abuse"><%=link_to image_tag("report-abuse.jpg", :border=>"0px") + "&nbsp;&nbsp;Report abuse", "javascript:openReportAbuse("+params[:id]+");" -%></div>
        </div>

        <div class="get-more-info">
          <%=image_tag "get-more-info.jpg", :border=>"0px" -%>&nbsp;&nbsp;Get More Information
        </div>

        <div class="form-tabs">
          <ul>
            <li class="selected-tab"> <%=link_to image_tag("email-and-sms.jpg", :border=>"0px") + "&nbsp;&nbsp;E-mail and SMS", "#" -%></li>
            <li><%=link_to image_tag("get-phone-number.jpg", :border=>"0px") + "&nbsp;&nbsp;Get Phone Number", "#" -%></li>
          </ul>
        </div>
        <%=render :partial => "advertisments/query_form"%>
        <div class="tips">Safety Tips</div>
    </div>
  </div>
</div>

<div class="similar-ads">
  <div class="similar-ad-header">Similar Ads</div>
  <% @similarads.each do |similarads|%>
    <div class="similar-ad-heading"><%=similarads.title%></div>
    <div class="similar-ad-detail"><%=excerpt(similarads.description, ' ', 60) -%></div>
  <%end%>
</div>
<div class="separator3"><%=image_tag "line.jpg", :border=>"0px" -%></div>